#include <stdbool.h>
#include "Timer.h"

#ifndef DRIVE_ROUTINES_H_
#define DRIVE_ROUTINES_H_

typedef struct testResult 
{
	unsigned int score;
	ts_t* startTime;
	ts_t* endTime;
	ts_t* elapsedTime;

} tr_t;

/* Drive Status
 *-----------------------------
 *- Payton Byrd
 *-----------------------------
 * Used to store the drive number
 * and drive init. message for
 * each device.
 */
typedef struct drive_status
{
	unsigned char drive;
	bool isSelected;
	char message[40];
	tr_t* driveScores[14];

} ds_t;

extern ds_t drives[];

// Use this function, instead of cbm_open(), to open files.  It checks the DOS
// status message.  It returns a value greater than zero if the device cannot
// be found.  It returns a negative value if the DOS reports an error;
// then, the buffer array holds the error string.
signed char __fastcall__ cbmOpen(
	unsigned char lfn, unsigned char device,
	unsigned char sec_addr, const char* name,
	unsigned char errf);

signed char __fastcall__ sendCommand(
	const unsigned char drive,
	const char *command,
	char *results);

static int __fastcall__ getDriveStatus(
	ds_t *drive);

void enumerateDrives(const unsigned char initialDrive);

extern unsigned char __fastcall__ checkDrive(unsigned char drive);

#endif